package z.HHH;

public class Ticket {
    private  int num=100;
    public  void sale(){
        synchronized(this) {
            if (num > 0) {
                System.out.println(Thread.currentThread().getName() + "卖出了第" + (num--) + "张票，剩余" + num + "张票");
            }
        }
    }
    public int getNum(){
        return num;
    }
}
